import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (productType) => {
    const res = await request({
        url: "/a/content/productType/list",
        method: "post",
        params: {
            productType: productType.productType,
            pageNo: productType.pageNo,
            pageSize: productType.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveProductType = async (productType) => {
    const res = await request({
        url: "/a/content/productType/save",
        method: "put",
        params: {
            productType: productType.productType,
            sort:productType.sort,
            remarks:productType.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateProductType = async (productType) => {
    const res = await request({
        url: "/a/content/productType/update",
        method: "post",
        params: {
            id: productType.id,
            productType: productType.productType,
            sort:productType.sort,
            remarks:productType.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/productType/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getProductType = async (id) => {
    const res = await request({
        url: "/a/content/productType/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


//查询单条数据
fun.getListAll = async () => {
    const res = await request({
        url: "/a/content/productType/listAll",
        method: "post",
        params: {
        }
    })
    return res.data;
}


export default fun;